﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace StarForce {
    public class UiCardGraveyard : CardPile {
        [SerializeField] [Tooltip("墓地位置")]
        private Transform m_GraveyardPosition;
        [SerializeField] private PlayerHand m_PlayerHand;

        protected override void Awake() {
            base.Awake();
            m_PlayerHand.OnCardPlay += AddCard;
        }


        public override void AddCard(Card card) {
            if (card == null) {
                throw new ArgumentNullException("Card Cant not be null!");
            }
            CardList.Add(card);
            card.transform.SetParent(m_GraveyardPosition);
            NotifyPileChange();
        }

        public override void RemoveCard(Card card) {
            if (card == null) {
                throw new ArgumentNullException("Card Cant not be null!");
            }
            CardList.Remove(card);
            NotifyPileChange();
        }
    }
}
